function [ outputfilter error_rate ] = run_vb_stl( traintasks,testtasks ,pca_dimensionality)
%-----------------------------------------------------
% Initialize, run and evaluate VB single-task model
%-----------------------------------------------------

 % train using only the task-of-interest
  % 0.05 is the prior variance of parameters
  [posterior,prior] = initialize_rsl({traintasks}, 0.05); 
  % 500 is number of iterations
  posterior2 = optimize_rsl(posterior, prior, {traintasks}, 500); 
  classprobabilities = predict_rsl(posterior2, testtasks);
  classifications = -1 + 2*(classprobabilities > 0.5);
  classaccuracy = sum(classifications == testtasks(:,end))/size(testtasks,1);
 

  outputfilter = posterior2{2}(1:pca_dimensionality);
  error_rate = classaccuracy;


end

